<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;
/**
 * @property int $id 主键
 * @property int $mid 机构ID
 * @property int $car_id 关联车辆
 * @property string $oilnum 油号
 * @property string $addoil_time 加油时间
 * @property string $cost 加油费用
 * @property int $oilcard 关联油卡
 * @property int $status 状态
 * @property string $remark 备注
 * @property int $created_user 创建人
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 更新时间
 * @property string $deleted_at 软删除字段
 */
class VehicleAddoilRecord extends BaseModel
{
    use SoftDeletes;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'vehicle_addoil_records';

    protected $hidden = ['deleted_at'];
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['id', 'mid', 'car_id', 'oilnum', 'addoil_time', 'cost', 'oilcard', 'status', 'remark', 'created_user', 'created_at', 'updated_at', 'deleted_at'];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'mid' => 'integer', 'car_id' => 'integer', 'oilcard' => 'integer', 'status' => 'integer', 'created_user' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
    /**
     * [org 机构]
     * @return [type] [description]
     */
    public function org()
    {
        return $this->hasOne(Institution::class, 'id', 'mid');
    }
    /**
     * [vehicle 关联车辆]
     * @return [type] [description]
     */
    public function vehicle()
    {
        return $this->hasOne(Vehicle::class, 'id', 'car_id');
    }
    /**
     * [oilcard 关联油卡]
     * @return [type] [description]
     */
    public function oilcard()
    {
        return $this->hasOne(Oilcard::class, 'id', 'oilcard');
    }
}